<div class="layui-card">
    <div class="layui-card-header">CURD生成</div>
    <div class="layui-card-body">
        <form class="layui-form layui-form-pane" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">数据表</label>
                <div class="layui-input-block">
                    <select name="tableName" lay-verify="required">
                        <option value="">请选择数据表</option>
                        <?php if (!empty($dbTables)): ?>
                        <?php foreach ($dbTables as $key => $value) {?>
                        <option value="<?=$value['Name']?>" <?=(isset($postdata['tableName']) and $postdata['tableName'] == $value['Name'])?'selected':''?>><?=$value['Name']?> - <?=$value['Comment']?></option>
                        <?php } ?>
                        <?php endif; ?>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">分类递归</label>
                <div class="layui-input-block">
                    <input type="radio" name="recursion" value="1" title="是" <?=(isset($postdata['recursion']) and $postdata['recursion'] == 1)?'checked':''?>>
                    <input type="radio" name="recursion" value="2" title="否" <?=((isset($postdata['recursion']) and $postdata['recursion'] == 2) or !isset($postdata['recursion']))?'checked':''?>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">生成权限</label>
                <div class="layui-input-block">
                    <input type="radio" name="auth" value="1" title="是" <?=(isset($postdata['auth']) and $postdata['auth'] == 1)?'checked':''?>>
                    <input type="radio" name="auth" value="2" title="否" <?=((isset($postdata['auth']) and $postdata['auth'] == 2) or !isset($postdata['auth']))?'checked':''?>>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否覆盖</label>
                <div class="layui-input-block">
                    <input type="radio" name="cover" value="1" title="是">
                    <input type="radio" name="cover" value="2" title="否" checked>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">生成：</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="create[dbmodel]" title="数据模型" <?=(isset($postdata['create']['dbmodel']) or !isset($postdata['create']))?'checked':''?>>
                    <input type="checkbox" name="create[controller]" title="控制器" <?=(isset($postdata['create']['controller']) or !isset($postdata['create']))?'checked':''?>>
                    <input type="checkbox" name="create[index]" title="Index视图" <?=(isset($postdata['create']['index']) or !isset($postdata['create']))?'checked':''?>>
                    <input type="checkbox" name="create[form]" title="_Form视图" <?=(isset($postdata['create']['form']) or !isset($postdata['create']))?'checked':''?>>
                </div>
            </div>
            <input type="submit" class="layui-btn" lay-submit lay-filter="formDemo" value="立即生成">
        </form>
    </div>
    <?php if (!empty($makeRes)): ?>
    <div class="layui-card-header">生成结果</div>
    <div class="layui-card-body">
        <?php foreach ($makeRes as $k => $value) {?>
        <?php if (!empty($value)): ?>
        <span class="layui-badge layui-bg-green">成功</span> <?=$value?> <br>
        <?php endif; ?>
        <?php } ?>
    </div>
    <?php endif; ?>
</div>

{if !empty($msg)}
    {foreach $msg as $key=>$vo }
        {eq name="$key" value="succeed"}
            {foreach $vo as $pKey=>$pVo }
                <p style="margin-bottom: 5px"><span class="layui-badge layui-bg-green">成功</span> {$pVo}</p>
            {/foreach}
        {/eq}
        {eq name="$key" value="error"}
            {foreach $vo as $pKey=>$pVo }
                <p style="margin-bottom: 5px"><span class="layui-badge">失败</span> {$pVo}</p>
            {/foreach}
        {/eq}
    {/foreach}
{/if}
